@extends('layouts/app')

@section('content')
    <div class="shops-detail">

        {{--菜品图片轮播--}}
        <div class="shops-img">
            <div class="swiper-container">
                <!-- Additional required wrapper -->
                <div class="swiper-wrapper">
                    <!-- Slides -->
                    {{--<div class="swiper-slide"><img src="/img/banner1.png" alt="" class="img-responsive"></div>--}}
                    {{--<div class="swiper-slide"><img src="/img/banner2.png" alt="" class="img-responsive"></div>--}}
                    {{--<div class="swiper-slide"><img src="/img/banner3.png" alt="" class="img-responsive"></div>--}}
                </div>
                <!-- If we need pagination -->
                <div class="swiper-pagination"></div>
            </div>
        </div>

        {{--<div class="weui-form-preview" style="min-height:100%;">--}}
            {{--<div class="weui-form-preview__hd">--}}
                {{--<label class="weui-form-preview__label">名称</label>--}}
                {{--<em class="weui-form-preview__value">我是包间</em>--}}
            {{--</div>--}}
            {{--<div class="weui-form-preview__bd">--}}
                {{--<div class="weui-form-preview__item">--}}
                    {{--<label class="weui-form-preview__label">类型</label>--}}
                    {{--<span class="weui-form-preview__value">桌子</span>--}}
                {{--</div>--}}
                {{--<div class="weui-form-preview__item">--}}
                    {{--<label class="weui-form-preview__label">容纳人数</label>--}}
                    {{--<span class="weui-form-preview__value">8人</span>--}}
                {{--</div>--}}
                {{--<div class="weui-form-preview__item">--}}
                    {{--<label class="weui-form-preview__label">最低消费</label>--}}
                    {{--<span class="weui-form-preview__value">20元</span>--}}
                {{--</div>--}}
                {{--<div class="weui-form-preview__item">--}}
                    {{--<label class="weui-form-preview__label">状态</label>--}}
                    {{--<span class="weui-form-preview__value">使用中</span>--}}
                {{--</div>--}}
                {{--<div class="weui-form-preview__item">--}}
                    {{--<label class="weui-form-preview__label">说明</label>--}}
                    {{--<span class="weui-form-preview__value">没什么好说的</span>--}}
                {{--</div>--}}

            {{--</div>--}}
        {{--</div>--}}
    </div>



    <script>


        var id = getRequest().id; // 房桌ID

        // 幻灯
        var mySwiper = new Swiper('.swiper-container', {
            direction: 'horizontal',
            loop: true,
            // 如果需要分页器
            pagination: '.swiper-pagination',
            autoplay : 3000,
            speed: 300
        });

        function getRoomInfo () {
            $.post("/api/showRoom", {id: id}, function (res) {
                if (typeof res === 'string') {
                    res = JSON.parse(res);
                }

                console.log("res", res);
                createImageList (res.data.thumb);
                var ldata = {};
                ldata['type'] = 'roomDetail';
                ldata['element'] = '.shops-detail';
                ldata['data'] = res.data;

                A.init(ldata);
            });
        }
        getRoomInfo();

        // 创建幻灯列表
        function createImageList (strUrl) {
            var arr = strUrl.split(';'),
                htmlText = [];
            console.log("arr", arr);
            for (var i = 0, len = arr.length; i < len; i++) {
                htmlText.push('<div class="swiper-slide"><img src="'+ arr[i] + '" alt="" class="img-responsive"></div>');

            }

            $(".swiper-wrapper").html(htmlText.join(''))
        }
    </script>

@endsection

@extends('layouts/footer')
